
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<script type="text/css">
    table{
    border: 1px solid black;
    width: 40px;
    height: 20px;
    }
</script>
<script src="js/jquery-3.1.1.js" type="text/javascript"></script>
<body>
    ${admin.adminName}:登陆成功!<br/>

<a href="addBoard.html">添加板块</a>|<a href="ToAddNewsServlet">添加新闻</a>
    <br>
    <form action="ToMainServlet" method="post">
        <input type="text" name="keyword" size="50" placeholder="请输入关键字:" id="soso">
        <input type="submit" value="soso">
    </form>
    <span id="sp"></span>
<table border="1" cellpadding="0" cellspacing="0">
    <tr>
        <th>编号</th>
        <th>标题</th>
        <th>板块</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${newsList}" var="n">
        <tr>
            <td>${n.newsId}</td>
            <td>${n.title}</td>
            <td>${n.board.boardName}</td>
            <td><a href="ToEditNewsServlet?newsId=${n.newsId}&${n.board.boardName}">修改</a><a href="">删除</a></td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="4" width="20">
            <a href="ToMainServlet?pageIndex=1&keyword=${keyword}">首页</a>
            <a href="ToMainServlet?pageIndex=${pageIndex-1}&keyword=${keyword}">上一页</a>
            <a href="ToMainServlet?pageIndex=${pageIndex+1}&keyword=${keyword}">下一页</a>
            <a href="ToMainServlet?pageIndex=${totalPages}&keyword=${keyword}">末页</a>
        </td>
    </tr>
</table>

<script>
    $(function () {
        $("#soso").blur(function () {
            $.ajax({
                url:"/helpSerchNewsServlet",
                type:"POST",
                data:{
                    "newstitle":$("#soso").val()
                },
                success:function (result) {
                    $("#sp").html("<p>result</p>");
                }
            })
        })

    })
</script>
</body>
</html>
